package leetCode.function;


public class Hanoi {
    public static void main(String[] args) {
		new Hanoi().trance(5, "left", "mid", "right");
	}
    
    private void trance(int n, String from, String to, String other) {
    	if(n==1) {
    		System.out.println(1+ " " + from + " " + to);
    	}else {
    		trance(n-1, from, other, to);
    		System.out.println(n+ " " + from + " " +to);
    		trance(n-1, other, to, from);
    	}
    } 
}
